package com.ihg.hiex.admin.dao.session;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.ihg.hiex.entity.session.Session;
import com.ihg.hiex.entity.session.meeting.SessionMeeting;

/**
 *
 * @author Ark
 *
 */
@Dao("hibernate")
public interface SessionMeetingDao {

    /**
     * @param session
     * @param names
     * @return
     */
    @Query("FROM SessionMeeting WHERE disabled = false AND session = :session AND name IN (:names)")
    public List<SessionMeeting> list(@Variable("session") Session session, @Variable("names") List<String> names);
    
    /**
     * @param session
     * @param name
     * @return
     */
    @Query("FROM SessionMeeting WHERE disabled = false AND session = :session AND name = :name")
    public List<SessionMeeting> list(@Variable("session") Session session, @Variable("name") String name);
    
    /**
     * 
     * @param owner
     * @param name
     * @return
     */
    @Query("FROM SessionMeeting WHERE disabled = false AND owner = :owner AND name = :name")
    public List<SessionMeeting> list(@Variable("owner") Long owner, @Variable("name") String name);
    
    /**
     * @param session
     * @param name
     * @return
     */
    @Query("FROM SessionMeeting WHERE disabled = false AND session = :session AND name = :name")
    public SessionMeeting load(@Variable("session") Session session, @Variable("name") String name);
    
    /**
     * @param session
     * @param name
     * @param owner
     * @return
     */
    @Query("FROM SessionMeeting WHERE disabled = false AND session = :session AND name = :name AND owner = :owner")
    public SessionMeeting load(@Variable("session") Session session, @Variable("name") String name, @Variable("owner") Long owner);
    
    /**
     * @param session
     * @param name
     * @param subgroup
     * @return
     */
    @Query("FROM SessionMeeting WHERE disabled = false AND session = :session AND name = :name AND subgroup = :subgroup")
    public SessionMeeting load(@Variable("session") Session session, @Variable("name") String name, @Variable("subgroup") String subgroup);
    
    /**
     * 
     * @param session
     * @param name
     * @param owner
     * @param delegate
     * @return
     */
    @Query("FROM SessionMeeting WHERE disabled = false AND session = :session AND name = :name AND owner = :owner AND delegate = :delegate")
    public SessionMeeting load(@Variable("session") Session session, @Variable("name") String name, @Variable("owner") Long owner, @Variable("delegate") Long delegate);
    
}
